﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frogism.Core.WorkOut;
namespace Frogism.Data {
  public class ActivityTypeLoader: LoaderBase<ActivityType,IActivityType> {

    protected override void FillObject(IActivityType aType, FriendlyReader reader) {
     // base.FillObject(aType, reader);
      aType.Id = reader.Int("Id");
      aType.Name = reader.String("Name");
      //Core.WorkOut.ActivityType aType = ((Core.WorkOut.ActivityType)i);
      aType.Calories = reader.Decimal("Calories");
      aType.ActivityGroup = ActivityGroupFind(reader.Int("ActivityGroupId"));
      aType.Unit = reader.String("Unit");

    }

    private Frogism.Core.WorkOut.ActivityGroup ActivityGroupFind(int p) {        
      switch (p) {
        case 1:
          return Frogism.Core.WorkOut.ActivityGroup.WorkOut;
        case 2:
          return Frogism.Core.WorkOut.ActivityGroup.Consumption;
        default:
          return Frogism.Core.WorkOut.ActivityGroup.Other;

      }
    }
    
    protected override string ProcNameGetById {
      get {
        return "ActivityTypeGetById";
      }
    }
    protected override Core.WorkOut.IActivityType GetEmptyObject() {
      return new Core.WorkOut.ActivityType();
    }

    protected override string ProcNameGetAll {
      get { return "ActivityTypeGetAll"; }
    }
  }
}
